package pATT.DataSetsGenerator.dataSetsGenerator.attribute.implement;


public class NominalAttribute extends Attribute {
	
	private boolean weight = false;
	private double weightPercent;
	private String weightValue;
	private String stringValues = "";
	
	@SuppressWarnings("unchecked")
	public NominalAttribute(boolean null1, String name, String type, String stringValues1) {
		super(null1, name, type);
		stringValues = stringValues1;
		recoveryValues(stringValues1);
	}
	
	@SuppressWarnings("unchecked")
	private void recoveryValues(String stringValues) {
		
		stringValues = stringValues.trim();
		int pos=stringValues.indexOf(",");
		while(pos != -1){
			values.addElement(stringValues.substring(0,pos));
			stringValues = stringValues.substring(pos+1,stringValues.length());
			pos=stringValues.indexOf(",");
		}
		if(!(stringValues.equals(""))){
			values.addElement(stringValues);
		}
	}
	
	public void setNewValues(String stringValues){
		this.stringValues = stringValues;
		values.removeAllElements();
		recoveryValues(stringValues);
		
	}
	
	public boolean isWeight() {
		return weight;
	}
	
	public void setWeight(boolean weight) {
		this.weight = weight;
	}
	
	public double getWeightPercent() {
		return weightPercent;
	}
	
	public void setWeightPercent(double weightPercent) {
		this.weightPercent = weightPercent;
	}
	
	public String getWeightValue() {
		return weightValue;
	}
	
	public void setWeightValue(String weightValue) {
		this.weightValue = weightValue;
	}

	public String getStringValues() {
		return stringValues;
	}
}
